package com.yunfeng.greenfarm.dao.impl;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.yunfeng.greenfarm.dao.IUserBasicDao;
import com.yunfeng.greenfarm.model.user.UserBasic;

@Repository
@Transactional
public class UserBasicDaoImpl extends CustomHibernateDaoSupport<UserBasic>
		implements IUserBasicDao {

	@Override
	@Transactional
	public UserBasic findByUserId(String userId) {
		// return
		// (UserBasic)this.getSession().createQuery("from UserBasic").list().get(0);
		UserBasic userBasic = (UserBasic) this.getSession().load(
				UserBasic.class, userId);
		if (null != userBasic) {
			this.getSession().evict(userBasic);
			return userBasic;
		}
		return null;
	}

}
